package com.ruoyi.buss.dxts.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.buss.dxts.domain.MessagePohne;
import com.ruoyi.buss.dxts.service.IMessagePohneService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 短信发送手机号配置Controller
 * 
 * @author zjh
 * @date 2021-12-09
 */
@RestController
@RequestMapping("/MessagePohne")
public class MessagePohneController extends BaseController
{
    @Autowired
    private IMessagePohneService messagePohneService;

    /**
     * 查询短信发送手机号配置列表
     */
    @PreAuthorize(hasPermi = "buss:MessagePohne:list")
    @GetMapping("/list")
    public TableDataInfo list(MessagePohne messagePohne)
    {
        startPage();
        List<MessagePohne> list = messagePohneService.selectMessagePohneList(messagePohne);
        return getDataTable(list);
    }

    /**
     * 导出短信发送手机号配置列表
     */
    @PreAuthorize(hasPermi = "buss:MessagePohne:export")
    @Log(title = "短信发送手机号配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MessagePohne messagePohne) throws IOException
    {
        List<MessagePohne> list = messagePohneService.selectMessagePohneList(messagePohne);
        ExcelUtil<MessagePohne> util = new ExcelUtil<MessagePohne>(MessagePohne.class);
        util.exportExcel(response, list, "短信发送手机号配置数据");
    }

    /**
     * 获取短信发送手机号配置详细信息
     */
    @PreAuthorize(hasPermi = "buss:MessagePohne:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(messagePohneService.selectMessagePohneById(id));
    }

    /**
     * 新增短信发送手机号配置
     */
    @PreAuthorize(hasPermi = "buss:MessagePohne:add")
    @Log(title = "短信发送手机号配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MessagePohne messagePohne)
    {
        return toAjax(messagePohneService.insertMessagePohne(messagePohne));
    }

    /**
     * 修改短信发送手机号配置
     */
    @PreAuthorize(hasPermi = "buss:MessagePohne:edit")
    @Log(title = "短信发送手机号配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MessagePohne messagePohne)
    {
        return toAjax(messagePohneService.updateMessagePohne(messagePohne));
    }

    /**
     * 删除短信发送手机号配置
     */
    @PreAuthorize(hasPermi = "buss:MessagePohne:remove")
    @Log(title = "短信发送手机号配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(messagePohneService.deleteMessagePohneByIds(ids));
    }
}
